#!/bin/bash
#Desc 打包: $cmd clean|compile|package|install|deploy
#Auth zongf
#Date 2023-05-17

# 设置jdk为21

os_name=$(uname -s)
if [ "$os_name" == "Linux" ]; then
  export JAVA_HOME=/opt/apps/jdk/jdk-21.0.4
else
  export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
fi

mvn -version

# 工作空间,项目根目录
workspace=`cd ../.. && pwd`
echo "workspace:$workspace"

# 打包命令
goals=$1
if [ x$goals == "x" ]; then
  goals="clean"
fi

mvnCmd="mvn $goals -DskipTests=true "

# 按依赖顺序依次打包
cd $workspace/base/swan-dependencies && $mvnCmd

cd $workspace/base/swan-parent && $mvnCmd

cd $workspace/commons && $mvnCmd

cd $workspace/starters && $mvnCmd

